package com.hsoft.zhxy.app.demo_03_01.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hsoft.zhxy.app.demo_03_01.model.entity.DemoEntity;
import com.hsoft.zhxy.app.demo_03_01.model.query.DemoQuery;
import com.hsoft.zhxy.app.demo_03_01.model.vo.DemoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * All rights Reserved, Designed By 哈尔滨工业大学软件工程股份有限公司
 *
 * @Title: GET请求(DEMO) 适用于数据查询及数据删除
 * @Package
 * @Description:
 * @author: zhouzhuoqun
 * @date: 2020-10-24
 */
@Mapper
@Repository
public interface DemoMapper extends BaseMapper<DemoEntity> {

    /**
     * 查询用户基础信息数据(分页)
     * @param pageObj
     * @param queryWrapper
     * @return IPage<DemoVO>
     */
    @Select("<script> " +
            "   select  yh.yhid,\n" +
            "           yh.xm,\n" +
            "           yh.sjh,\n" +
            "           yh.dzyx,\n" +
            "           yh.sfms,\n" +
            "           yh.sfzj,\n" +
            "           yh.kdlfs,\n" +
            "           yh.yhzt,\n" +
            "           yh.sjlybz,\n" +
            "           yh.bz,\n" +
            "           yh.cjsj,\n" +
            "           yh.bgsj,\n" +
            "           js.jsid,\n" +
            "           js.jsmc,\n" +
            "           bm.bmmc,\n" +
            "           bm.bmm\n" +
            "  from jcqx_yh yh\n" +
            "  left join jcqx_yhbm yhbm\n" +
            "    on yh.yhid = yhbm.yhid\n" +
            "  left join jcqx_bm bm\n" +
            "    on yhbm.bmm = bm.bmm\n" +
            "  left join jcqx_yhjs yhjs\n" +
            "    on yh.yhid = yhjs.yhid\n" +
            "  left join jcqx_js js\n" +
            "    on js.jsid = yhjs.jsid\n" +
            "  ${ew.customSqlSegment} " +    //获取条件构造器中拼接好的sql
            "</script>")
    IPage<DemoVO> findListYhjcxxByPage(Page<DemoQuery> pageObj, @Param("ew") QueryWrapper<DemoQuery> queryWrapper);
}
